package gameObject
{
	import away3d.containers.ObjectContainer3D;
	import away3d.entities.Mesh;
	
	import controller.bullets.BullectControllerBase;
	import controller.bullets.StraightBullet;
	
	import gameObject.resources3D.BulletResource;

	public class SingleBullet extends ObjectContainer3D
	{
		private var _controller:BullectControllerBase;
		private var _resource:BulletResource;
		private var _power:int;
		
		public function get resource():BulletResource
		{
			return _resource;
		}
		
		public function set controller(Controller:BullectControllerBase):void
		{
			if(Controller)Controller.setup(this);
			_controller = Controller;
		}
		
		public function get controller():BullectControllerBase
		{
			return _controller;
		}
		
		public function disposeController():void
		{
			if(_controller)_controller.dispose();
		}
		
		public function copyAsMesh():Mesh
		{
			return (new Mesh(_resource.mesh.geometry,_resource.mesh.subMeshes[0].material));
		}
		
		public function SingleBullet(Resource:BulletResource,power:int)
		{
			_resource = Resource;
			_power = power;
			
//			switch(_res.type)
//			{
//				case 1:
//					controller = new StraightBullet(Global.gameTimer01);
//					break;
//					
//				default:
//					break;
//			}
		}
		
		
	}
}